﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using MINERP.StartOrder.Forms;

namespace MINERP.StartOrder
{
    public partial class FrmProcessBar : Form
    {
        public FrmProcessBar()
        {
            InitializeComponent();
        }

        private void FrmProcessBar_Load(object sender, EventArgs e)
        {
            
            backgroundWorker1.RunWorkerAsync();
        }

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            MovePhoto(worker);
        }


        private void MovePhoto(BackgroundWorker work)
        {
            for (int i = 0; i <= 1000; i++)
            {
                if (i == 1000)
                {
                    i = 0;
                }
                work.ReportProgress(i);
                Thread.Sleep(10);
            }
 
        }

        private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            processBar.Value = e.ProgressPercentage;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            ((FrmMain)this.Owner).Cancelorder();
            this.Close();
            this.Dispose();
        }

      
    }
}
